import re
import allure


@allure.step(title="断言检查值相等")
def is_equal(data, expect, info=""):
    if data == expect:
        allure.attach("断言 %s" % info, '%s == %s 断言通过' % (data, expect))
        return True
    else:
        allure.attach("断言 %s" % info, '%s == %s 断言不通过' % (data, expect))
        return False

@allure.step(title="断言正则匹配")
def is_full_match(pattern, string, info=""):
    match_obj = re.fullmatch(pattern=pattern, string=string)
    if match_obj:
        allure.attach("断言 %s" % info, '%s fullmatch %s 断言通过' % (pattern, string))
        return True
    else:
        allure.attach("断言 %s" % info, '%s fullmatch %s 断言不通过' % (pattern, string))
        return False